package com.boot.repository;

import com.boot.entity.CourseInfo;
import com.boot.vo.Course;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;


import javax.persistence.criteria.CriteriaBuilder;
import javax.transaction.Transactional;
import java.util.List;

@Transactional
@Repository
public interface CourseInfoRepository extends JpaRepository<CourseInfo, Integer>, JpaSpecificationExecutor<CourseInfo> {


    List<CourseInfo> findAllByWorkNumber(String s);


    CourseInfo findByCourseSerialNumber(Integer i);


    List<CourseInfo> findAllByFlagAndCourseName(Boolean flag,String name);
    List<CourseInfo> findAllByMajorId(Integer id);
    List<CourseInfo> findAllByTermId(Integer id);
    List<CourseInfo> findAllByFlag(Boolean flag);
    List<CourseInfo> findAllByWorkNumberAndTermId(String workNum, Integer termid);
    List<CourseInfo> findAllByCourseNumberLike(Integer cnum);
    List<CourseInfo> findAllByCourseNameLike(String cname);


    Boolean existsByCourseSerialNumber(Integer integer);

    Boolean existsByWorkNumberAndTermId(String worknum, Integer termid);

    void deleteByCourseSerialNumber (Integer integer);


    Boolean existsByWorkNumber(String worknum);
}